#include<iostream>
#include<cstring>
using namespace std;
const int N=1e5;//1e5
int a[N];
int n;
int res=0x3f,cnt;
bool st[N],dead[N];
int dfs(int x,int c)
{
    if(x==n)
    {
        cnt=n;
        for(int i=2;i<=n;i++)
            if(dead[i]==1)
                cnt--;
        return cnt;
    }
    for(int i=1;i<=n;i++)
    {
        if(x!=i&&!st[i])
        {
            if(c==1&&cnt!=0){
                res=min(res,cnt);
            }
            st[i]=1;
            if(a[x]<=a[i]){
               dead[i]=1;
            }
            dfs(i,c+1);
            st[i]=0;
            dead[i]=0;

        }
    }
}
int main()
{
//Remember to guan bi zhu shi
//    freopen(".in","r",stdin);
//    freopen(".out","w",stdout);
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    dfs(1,1);
    printf("%d",res);
    return 0;
}
